/**
 * @a https://leetcode.cn/problems/longest-common-prefix/description/
 */
#include "common.h"

class Solution {
public:
    string longestCommonPrefix(vector<string>& strs) {
        string ret;
        int min_sz = 201;
        for(auto &str:strs) min_sz = (min_sz < str.size()) ? min_sz : str.size();

        for(int cur = 0; cur < min_sz; cur++){
            for(int i = 0; i < strs.size() - 1; ++i){
                if(strs[i][cur] != strs[i+1][cur]) return ret;
            }
            ret += strs[0][cur];
        }
        return ret;
    }
};